<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html" omit-xml-declaration="yes"/>
    <xsl:template match="/">
        <html>
            <head>
              <link rel="stylesheet" type="text/css" href="css/screen.css" /> 
              <title>Chupacabra :: Employee list</title>
            </head>
            <body>
                <div id="header">
                  <ul>
                    <li class="inactive"><a href="/peaa/jobs.htm">Jobs</a></li>
                    <li class="inactive"><a href="/peaa/departments.htm">Departments</a></li>
                    <li class="active"><a href="#">Employees</a></li>
                  </ul>
                </div>
                <div class="clear" />
                <div id="content">
                <h1>Employees</h1>
                <table>
                    <form name="employees" id="employees" action="employees.htm">
                    <tr><th>XX%</th><td><input type="text" name="xx" id="xx"/></td></tr>
                    <tr><th>YY%</th><td><input type="text" name="yy" id="yy"/></td></tr>
                    <tr><td><input type="reset" value="Reset"/></td><td><input type="submit" Value="List"/></td></tr>
                    </form>
                </table>
                <table>
                    <tr align="left"><th>Average Salary</th><td><xsl:value-of select="format-number(employees/average_salary, '#.00')" /></td></tr>
                    <tr><th>Number of employees</th><td><xsl:value-of select="employees/count" /></td></tr>
                </table>
                <form name="buttons">
                    <input type="button" value="Add employees" onclick="window.location='employee_new.htm'"></input>
                </form>
                <table class="employee_table">
                  <tr>
                    <th>Id</th>
                    <th>FirstName</th>
                    <th>LastName</th>
                    <th>Email</th>
                    <th>Phone</th>
                    <th>HireDate</th>
                    <th>JobId</th>
                    <th>Salary</th>
                    <th>CommisionPct</th>
                    <th>ManagerId</th>
                    <th>DepartmentId</th>
                  </tr>
                  <xsl:for-each select="employees/employee">
                      <tr>
                        <xsl:attribute name="class">
                  	  		<xsl:choose>
                        		<xsl:when test="@color='green'">tr_green</xsl:when>                   	
		                      	<xsl:when test="@color='red'">tr_red</xsl:when>    
                        		<xsl:otherwise>#ffffff</xsl:otherwise>
                      		</xsl:choose>
                    	</xsl:attribute>
                        <td>
                          <a>
                            <xsl:attribute name="href">employee.htm?id=<xsl:value-of select="id" /></xsl:attribute>
                            <xsl:value-of select="id" />
                          </a>
                        </td>
	                    <td><xsl:value-of select="first_name" /></td>
    	                <td><xsl:value-of select="last_name" /></td>
        	            <td><xsl:value-of select="email" /></td>
            	        <td><xsl:value-of select="phone" /></td>
                	    <td><xsl:value-of select="hire_date" /></td>
                    	<td><xsl:value-of select="job_id" /></td>
                      	<td align="right"><xsl:value-of select="salary" /></td>
                      	<td align="right"><xsl:value-of select="commission_pct" /></td>
                      	<td><xsl:value-of select="manager_id" /></td>
                      	<td><xsl:value-of select="department_id" /></td>
                      </tr>
                  </xsl:for-each>
                </table>
                </div>
            </body>
        </html>
    </xsl:template>
</xsl:stylesheet>